﻿@using System.Threading.Tasks
@using MyCompanyName.AbpZeroTemplate.Web.Areas.AppAreaName.Models.Languages
@using MyCompanyName.AbpZeroTemplate.Web.Areas.AppAreaName.Startup
@using MyCompanyName.AbpZeroTemplate.Web.Startup
@model LanguageTextsViewModel
@{
    ViewBag.CurrentPageName = AppAreaNamePageNames.Common.Languages;
}

@section Scripts
{
    <script abp-src="/view-resources/Areas/AppAreaName/Views/_Bundles/language-texts.js" asp-append-version="true"></script>
}

<div class="kt-subheader kt-grid__item">
    <div class="kt-subheader__main">
        <h3 class="kt-subheader__title">
            <span>@L("LanguageTexts")</span>
        </h3>
        <span class="kt-subheader__separator kt-subheader__separator--v"></span>
        <span class="kt-subheader__desc">
            @L("LanguageTextsHeaderInfo")
        </span>
    </div>
</div>

<div class="kt-content">
    <div class="kt-portlet">
        <div class="kt-portlet__body">
            <div class="kt-form" id="TextsFilterForm">
                <div class="row align-items-center mb-4">
                    <div class="col-sm-6 col-md-3">
                        <div class="form-group">
                            <label for="TextBaseLanguageSelectionCombobox">@L("BaseLanguage")</label>
                            <select id="TextBaseLanguageSelectionCombobox" name="BaseLanguage"
                                    class="form-control bs-select"
                                    data-live-search="true">
                                @foreach (var language in Model.Languages)
                                {
                                    <option data-icon="@language.Icon" value="@language.Name" selected="@(language.Name==Model.BaseLanguageName)">
                                        <i class="@language.Icon"></i>@language.DisplayName
                                    </option>
                                }
                            </select>
                        </div>
                    </div>
                    <div class="col-sm-6 col-md-3">
                        <div class="form-group">
                            <label for="TextTargetLanguageSelectionCombobox">@L("TargetLanguage")</label>
                            <select id="TextTargetLanguageSelectionCombobox" name="TargetLanguage"
                                    class="form-control bs-select"
                                    data-live-search="true">
                                @foreach (var language in Model.Languages)
                                {
                                    <option data-icon="@language.Icon" value="@language.Name" selected="@(language.Name==Model.LanguageName)">
                                        <i class="@language.Icon"></i>@language.DisplayName
                                    </option>
                                }
                            </select>
                        </div>
                    </div>
                    <div class="col-sm-6 col-md-3">
                        <div class="form-group">
                            <label for="TextSourceSelectionCombobox">@L("Source")</label>
                            @Html.DropDownList(
                                    "SourceName",
                                    Model.Sources,
                                    new
                                    {
                                        @class = "form-control selectpicker",
                                        data_live_search = "true",
                                        id = "TextSourceSelectionCombobox"
                                    })
                        </div>
                    </div>
                    <div class="col-sm-6 col-md-3">
                        <div class="form-group">
                            <label for="TargetValueFilterSelectionCombobox">@L("TargetValue")</label>
                            <select id="TargetValueFilterSelectionCombobox" class="form-control bs-select" name="TargetValue">
                                <option value="ALL" selected="@(Model.TargetValueFilter == "ALL")">@L("All")</option>
                                <option value="EMPTY" selected="@(Model.TargetValueFilter == "EMPTY")">@L("EmptyOnes")</option>
                            </select>
                        </div>
                    </div>
                </div>
                <div class="row align-items-center mb-4">
                    <div class="col-sm-12">
                        <div class="input-group">
                            <input id="TextFilter" value="@Model.FilterText" class="form-control" placeholder="@L("SearchWithThreeDot")" type="text">
                            <span class="input-group-btn">
                                <button id="RefreshTextsButton" class="btn btn-primary" type="submit"><i class="icon-refresh"></i> @L("Refresh")</button>
                            </span>
                        </div>
                    </div>
                </div>
            </div>
            <div class="row align-items-center">
                <table id="TextsTable" class="display table table-striped table-bordered table-hover dt-responsive nowrap">
                    <thead>
                    <tr>
                        <th></th>
                        <th>@L("Key")</th>
                        <th>@L("BaseValue")</th>
                        <th>@L("TargetValue")</th>
                        <th></th>
                    </tr>
                    </thead>
                </table>
            </div>
        </div>
    </div>
</div>